package com.jay.beiange.efccp.view;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.LinearLayout;

import com.jay.beiange.efccp.AboutActivity;
import com.jay.beiange.efccp.ChargeStandardActivity;
import com.jay.beiange.efccp.QuestionsActivity;
import com.jay.beiange.efccp.R;
import com.jay.beiange.efccp.SupportActivity;

/**
 * Created by Administrator on 2016/12/25 0025.
 */

public class HomeMenu  extends LinearLayout implements OnClickListener{
    private Context mContext;
    private View view;
    private LinearLayout mAbout,mChargeStandard,mQuestions,mSupport;

    public HomeMenu(Context context) {
        super(context);
        this.mContext = context;
    }

    public HomeMenu(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.mContext = context;
        view = LayoutInflater.from(context).inflate(R.layout.view_home_menu,this,true);
        initView();
        initEvent();
    }
    private void initView() {
        mAbout = (LinearLayout) findViewById(R.id.id_ll_home_menu_about);
        mChargeStandard = (LinearLayout) findViewById(R.id.id_ll_home_menu_charge_standard);
        mQuestions = (LinearLayout) findViewById(R.id.id_ll_home_menu_questions);
        mSupport = (LinearLayout) findViewById(R.id.id_ll_home_menu_support);

    }
    private void initEvent() {
        mAbout.setOnClickListener(this);
        mChargeStandard.setOnClickListener(this);
        mQuestions.setOnClickListener(this);
        mSupport.setOnClickListener(this);
    }


    @Override
    public void onClick(View view) {
        switch (view.getId())
        {
            case R.id.id_ll_home_menu_about:
                mContext.startActivity(new Intent(mContext,AboutActivity.class));
                //Toast.makeText(mContext,"我是公司简介",Toast.LENGTH_SHORT).show();
                break;
            case R.id.id_ll_home_menu_charge_standard:
                mContext.startActivity(new Intent(mContext,ChargeStandardActivity.class));
                //Toast.makeText(mContext,"我是收费标准",Toast.LENGTH_SHORT).show();

                break;
            case R.id.id_ll_home_menu_questions:
                mContext.startActivity(new Intent(mContext,QuestionsActivity.class));
                //Toast.makeText(mContext,"我是常见问题",Toast.LENGTH_SHORT).show();
                break;
            case R.id.id_ll_home_menu_support:
                mContext.startActivity(new Intent(mContext,SupportActivity.class));
                //Toast.makeText(mContext,"我是技术支持",Toast.LENGTH_SHORT).show();

                break;
        }

    }
}
